/**
 * @Author: 陈瑞鹏
 * @Date:   2023-01-11 18:21:51
 * @Last Modified by:   陈瑞鹏
 * @Last Modified time: 2023-01-12 15:55:54
 */
import gameCtr from "../ctrs/gameCtr";
import BaseGameComponent from "../libs/core/BaseGameComponent";
import { SceneManager } from "../libs/manager/SceneManager";

const { ccclass, property } = cc._decorator;
@ccclass
export default class rankCom extends BaseGameComponent {
  @property({ type: cc.Label, tooltip: "排名" })
  rankTxt: cc.Label = null;

  @property({ type: cc.Label, tooltip: "昵称" })
  nickName: cc.Label = null;

  @property({ type: cc.Label, tooltip: "积分" })
  jiTxt: cc.Label = null;

  public onEnable(): void {
    super.onEnable();
  }

  drawUi(data) {
    console.log(data)
    this.rankTxt.string = `第${data.rank}名`;
    this.nickName.string = `${data.nickName}`;
    if (gameCtr.ins.rankKey == "1") {
      if (gameCtr.ins.rankKey2 == "1") {
        this.jiTxt.string = `历史对战积分:${data.integral}`;
      } else {
        this.jiTxt.string = `周对战积分:${data.wIntegral}`;
      }
    } else {
      if (gameCtr.ins.rankKey2 == "1") {
        this.jiTxt.string = `历史冒险积分:${data.score}`;
      } else {
        this.jiTxt.string = `周冒险积分:${data.wScore}`;
      }
    }
  }

  onLqClick() {
    SceneManager.getInstance().pushLayer("tipLayer", "功能未开发!");
  }
}